#ifndef MODBUS_MASTER_H
#define MODBUS_MASTER_H
#include <vector>
#include <string>
#include <queue>
#include <mutex>
#include <thread>
#include "modbus.h"
#include "modbus_communication.h"
#include <modbus/modbus_master.h>

class ModbusMaster :public ModbusCommunication
{
public:
    explicit ModbusMaster(const std::shared_ptr<rclcpp::Node> node);
    ~ModbusMaster();
    int accept_host();
    virtual void start() override ;
    virtual void stop() override ;
    virtual int init(std::string host_ip,int host_port,int slave_id) override;
    virtual int init(std::string prefix) override ;
protected:
    void thread_cycle_tcp(ModbusMaster *pBase);
    void thread_cycle_rtu(ModbusMaster *pBase);
private:
    int server_socket;
    int  m_slave_id ;
    int  m_number ;

};

#endif